{* $Id$ *}
{include_core file="admin/lib/header.html" title="订单列表"}
<div class="page-header border-bottom clearfix">
    <h2 class="left">订单列表</h2>
</div>

<!--search-->
<div class="search-form js_advancedForm" >
    <form action="invoice/admin" method="get" class="js_focusSearchForm">
        <p>
            <label for="" class="search-f-label">订单编号：</label>
            <input type="text" class="search-f-ipt1" name="search_filter[order_code]"  value="{$search_filter.order_code}">
        </p>
        <p>
            <label for="" class="search-f-label">掌柜手机号：</label>
            <input type="text" class="search-f-ipt1" name="search_filter[user_name]" value="{$search_filter.user_name}">
        </p>
        <p>
            <label for="" class="search-f-label">下单时间：</label>
            <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[start_date_add]" value="{$search_filter.start_date_add}" id="startDate">
            <span class="search-f-line"></span>
            <input type="text" class="search-f-ipt1 search-f-ipt2" name="search_filter[end_date_add]" value="{$search_filter.end_date_add}" id="stopDate">
        </p>
        <p><label for="" class="search-f-label"></label><button type="submit" class="btn btn-success btn-xs js_searchBtn">搜索</button></p>
    </form>
</div>

<!--按状态检索-->
<div class="list-table-filters">
    <p>
        <span class="label label-info">按状态</span>
        <a href="{AnUrl("cinema_investment/admin/order_list?{URLTracker::set("progress", -1)}")}" {if $progress == -1} class="label label-primary" {else} class="label label-default" {/if}>全部</a>
        {foreach order_config::$store_progress as $k => $v}
        <a href="{AnUrl("cinema_investment/admin/order_list?{URLTracker::set("progress", $k)}")}" {if $progress == $k} class="label label-primary" {else} class="label label-default" {/if}>{$v}</a>
        {/foreach}
    </p>
</div>

{include_core file="admin/lib/pager.html"}

<table class="list-table goods-table">
    <thead>
    <tr>
        <th>订单编号</th>
        <th style="min-width: 80px;">下单日期</th>
        <th style="min-width: 200px;">商品</th>
        <th>单价(元)</th>
        <th>数量</th>
        <th>实际需支付(元)</th>
        <th>总数</th>
        <th>总价(元)</th>
        <th>合伙人</th>
        <th>影院名称</th>
        <th>影院负责人</th>
        <th>支付时间</th>
        <th style="min-width: 200px;">影院地址</th>
        <th>交易状态</th>
    </tr>
    </thead>
    <tbody>
    {foreach $order_list as $k=>$v}
        <tr><td colspan="15" class="hr">&nbsp;</td></tr>
        {if $v.order_relation_count}
            {foreach $v.order_relation as $key => $order_relation_info}
            <tr data-id="{$v.id}" id="dataList{$v.id}">
                {if $key == 0}
                    <td rowspan="{$v.order_relation_count}">
                        订单号：<br />{$v.order_code}<br />
                        {if $v.task_user_id}代理下单：<br>{$v.task_user_name}<br />{/if}
                        {if $v.task_desc}代理备注：<br>{$v.task_desc}<br /><br/>{/if}
                        {if $v.transaction_id}
                        交易号:<br/>{$v.transaction_id}
                        {/if}
                    </td>
                    <td rowspan="{$v.order_relation_count}">{str_replace(' ', '<br />', $v.add_time)}</td>
                {/if}
                <td>
                    <p>分类：{$order_relation_info.relation_goods_info.category_title}</p>
                    <p>商品名称：{$order_relation_info.relation_goods_info.title}</p>
                    <p>商品简介：{$order_relation_info.relation_goods_info.intro}</p>
                </td>
                <td>{$order_relation_info.goods_price}</td>
                <td>{$order_relation_info.goods_num}</td>
                <td>{$order_relation_info.real_price}</td>
                {if $key == 0}
                    <td rowspan="{$v.order_relation_count}">{$v.goods_num}</td>
                    <td rowspan="{$v.order_relation_count}">{$v.price}</td>
                    <td rowspan="{$v.order_relation_count}">{$v.dealer_info.realname} {$v.dealer_info.mobile}</td>
                    <td rowspan="{$v.order_relation_count}">
                        {if $v.user_role_id == user_config::STORE_MANAGER || $v.user_role_id == user_config::STORE_OWNER}
                            {$v.store_info.title}({$v.store_info.title_branch})
                        {/if}
                    </td>
                    <td rowspan="{$v.order_relation_count}">
                        {if $v.user_role_id == user_config::STORE_MANAGER || $v.user_role_id == user_config::STORE_OWNER}
                            {$v.user_info.realname} {$v.user_info.mobile}
                        {/if}
                    </td>
                    <td rowspan="{$v.order_relation_count}">
                        {if $v.pay_time != '0000-00-00 00:00:00'}
                            支付时间：{$v.pay_time}
                        {else}
                            未支付
                        {/if}
                    </td>
                    <td rowspan="{$v.order_relation_count}">
                        {if $v.user_role_id == user_config::STORE_MANAGER || $v.user_role_id == user_config::STORE_OWNER}
                            省：{$v.province_info}<br/>
                            市：{$v.city_info}<br/>
                            区：{$v.county_info}<br/>
                            详细地址：{$v.store_info.address}
                        {/if}
                    </td>
                    {$order_progress_list = order_config::$store_progress}
                    <td rowspan="{$v.order_relation_count}">
                        {if $v.progress == 1}
                        <span class="label label-warning">{$order_progress_list[$v.progress]}</span>
                        {elseif $v.progress == 10}
                        <span class="label label-success">{$order_progress_list[$v.progress]}</span>
                        {elseif $v.progress == 15}
                        <span class="label label-default">{$order_progress_list[$v.progress]}</span>
                        {else}
                        <span class="label label-info">{$order_progress_list[$v.progress]}</span>
                        {/if}
                    </td>
                {/if}
            </tr>
            {/foreach}
        {/if}
    {foreachelse}
        <tr><td class="txtleft" colspan="15">暂无数据</td></tr>
    {/foreach}
    </tbody>
</table>


{include_core file="admin/lib/pager.html"}
<!--end:列表-->
{include_core file="admin/lib/footer.html"}